package com.example.slidebutton;

import android.content.Context;
import android.graphics.Canvas;
import android.support.annotation.IntDef;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.util.Log;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Created by Alex-Zhang on 2017/11/18.
 */

public class LevelTextView extends android.support.v7.widget.AppCompatTextView {

    @IntDef({ONE, THREE})
    @Retention(RetentionPolicy.SOURCE)
    public @interface Level {
    }


    public static final int ONE = 12;
    public static final int THREE = 13;

    @Level
    public int getLevel(int level) {
        switch (level) {
            case 1:
                return ONE;
            default:
                return THREE;

        }
    }

    public LevelTextView(Context context) {
        super(context);
        init();
    }

    public LevelTextView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public LevelTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    private void init() {
        int level = getLevel(1);
        Log.d("level", "init: "+level);

    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
    }

}
